import { defHttp } from '/@/utils/http/axios';
import { ApiCommon } from '../common';

const { CUSTOMER_METER_API, APPROVAL_URL, CUSTOMER_ADMIN_API, SYS_ADMIN_API } = ApiCommon;
enum Api {
  CREATE_PERIOD_BASE_URL = '/period-change-meter/create', // 创建周期换表
  GET_METER_INFO = '/user-meter/user/getMeterInfo', // 获取账户的水表信息
  PERIOD_APPROVE_CHANGE_METER = `/period-change-meter/approve-change-meter`, //审批
  PAGE = `/period-change-meter/page`, //分页查询
  PERIOD_BASE_URL = `/period-change-meter`, //查询
  PERIOD_PROVIDER_METER = `/period-change-meter/provider-meter`, //发表
  PERIOD_CHANGE_METER = `/period-change-meter/change-meter`, //换表
  USER_READERS = `/user/readers`,
  USE_WATER_NATURE_CHANGE_DETAILS = `/user-water-usage-change/getUserWaterUsageChangeInfo`, // 用水性质变更工单详情
  USE_WATER_NATURE_CHANGE_DETAILS_DEPARTMENT = `/user-water-usage-change/departmentSurvey/submit/callback`, // 用水性质变更工单本地勘察审批
  USE_WATER_NATURE_CHANGE_DETAILS_APPPROVAL = `/user-water-usage-change/approval/submit/callback`, // 用水性质变更工单本地经理审批
}

// 获取账户的水表信息
export const getMeterInfoByUserId = (data: any) =>
  defHttp.get({ url: CUSTOMER_METER_API + Api.GET_METER_INFO + '/' + data });

// 获取账户的水表信息
export const postPeriodMeterChange = (data: any) =>
  defHttp.post({ url: APPROVAL_URL + Api.CREATE_PERIOD_BASE_URL, data });

// 业务办理-周期换表-审批
export const periodApproveChangeMeter = (data: any) =>
  defHttp.post({ url: CUSTOMER_ADMIN_API + Api.PERIOD_APPROVE_CHANGE_METER, data });

// 业务办理-换表-分页查询
export const periodChangeMeterPage = (data: any) =>
  defHttp.post({ url: CUSTOMER_ADMIN_API + Api.PAGE, data });

// 业务办理-周期换表-查询
export const periodPeriodChangeMeter = (data: any) => {
  console.log(data);
  return defHttp.get({ url: CUSTOMER_ADMIN_API + Api.PERIOD_BASE_URL + '/' + data });
};

// 业务办理-周期换表-发表
export const periodProviderMeter = (data: any) =>
  defHttp.post({ url: CUSTOMER_ADMIN_API + Api.PERIOD_PROVIDER_METER, data });

  // /v1.0/sys/admin/user/readers/1366616024881766078
  // 业务办理-周期换表-查询信息

export const getUserReaders = (params: any) =>
defHttp.get({ url: SYS_ADMIN_API + `${Api.USER_READERS}/${params.meterReaderId}` , params});


// 业务办理-周期换表-发表查询
export const getPeriodProviderMeter = (approvalBusinessHandlingId: any) =>
  defHttp.get({
    url: CUSTOMER_ADMIN_API + Api.PERIOD_PROVIDER_METER + '/' + approvalBusinessHandlingId,
  });
// 业务办理-周期换表-审批查询
export const getApproveList = (approvalBusinessHandlingId: any) =>
  defHttp.get({
    url: CUSTOMER_ADMIN_API + Api.PERIOD_BASE_URL + '/' + approvalBusinessHandlingId,
  });
// 业务办理-周期换表-换表
export const periodChangeMeter = (data: any) =>
  defHttp.post({ url: APPROVAL_URL + Api.PERIOD_CHANGE_METER, data });
  
// 业务办理-周期换表-换表
export const customerChangeMeter = (data: any) =>
  defHttp.post({ url: CUSTOMER_ADMIN_API + Api.PERIOD_CHANGE_METER, data });
// 业务办理-用水性质变更-查询
export const getUseWaterNatureChangeDetails = (params: any) =>
  defHttp.get({
    url: CUSTOMER_ADMIN_API + Api.USE_WATER_NATURE_CHANGE_DETAILS, params,
  });
// 业务办理-用水性质变更-本次测试勘察审批
export const useWaterNatureChangeLocalTestOfDepartment = (data: any) =>
defHttp.post({ url: CUSTOMER_ADMIN_API + Api.USE_WATER_NATURE_CHANGE_DETAILS_DEPARTMENT, data });
  // 业务办理-用水性质变更-本次测试经理审批
  export const useWaterNatureChangeLocalTestOfApproval = (data: any) =>
  defHttp.post({
    url: CUSTOMER_ADMIN_API + Api.USE_WATER_NATURE_CHANGE_DETAILS_APPPROVAL, data,
  });